🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / ble / src / commonMain / kotlin / org / meshtastic / core / ble / BleScanStartException.kt
Displaying Raw • Download
core/ble/src/commonMain/kotlin/org/meshtastic/core/ble/BleScanStartException.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 3.27 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ble
Tff7b72import T7ee787org.meshtastic.core.common.log.ExpectedCondition
Tff7b72import T7ee787kotlin.time.Duration
T8b949e/**
* Known reasons a BLE discovery scan failed before Android registered the scanner.
*
* Every reason here is an environment state — a permission not granted, a radio switched off, an OS quota — so
* [BleScanStartException] is an [ExpectedCondition] and is never reported as a crash.
*
* @property androidCode the platform-level code or constant this maps to, used in log lines.
* @property description a human-readable explanation for log lines.
* @property label the stable, low-cardinality [ExpectedCondition.expectedConditionLabel] for rate tracking.
*/
Tff7b72enum Tff7b72class T56d364BleScanStartFailureReasonTb4b4b4(Tff7b72val Te6edf3androidCodeTb4b4b4: Tffa657StringTb4b4b4, Tff7b72val Te6edf3descriptionTb4b4b4: Tffa657StringTb4b4b4, Tff7b72val Te6edf3labelTb4b4b4: Tffa657StringTb4b4b4) Tb4b4b4{
Te6edf3ApplicationRegistrationFailedTb4b4b4(
Te6edf3androidCode Tff7b72= Ta5d6ff"Ta5d6ffSCAN_FAILED_APPLICATION_REGISTRATION_FAILED(2)Ta5d6ff"Tb4b4b4,
Te6edf3description Tff7b72= Ta5d6ff"Ta5d6ffAndroid could not register the app for BLE scanningTa5d6ff"Tb4b4b4,
Te6edf3label Tff7b72= Ta5d6ff"Ta5d6ffble-scan-registration-failedTa5d6ff"Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3MissingScanPermissionTb4b4b4(
Te6edf3androidCode Tff7b72= Ta5d6ff"Ta5d6ffMISSING_SCAN_PERMISSIONTa5d6ff"Tb4b4b4,
Te6edf3description Tff7b72= Ta5d6ff"Ta5d6ffA runtime permission required for BLE scanning is not grantedTa5d6ff"Tb4b4b4,
Te6edf3label Tff7b72= Ta5d6ff"Ta5d6ffble-scan-missing-permissionTa5d6ff"Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3ScanningTooFrequentlyTb4b4b4(
Te6edf3androidCode Tff7b72= Ta5d6ff"Ta5d6ffSCAN_FAILED_SCANNING_TOO_FREQUENTLY(6)Ta5d6ff"Tb4b4b4,
Te6edf3description Tff7b72= Ta5d6ff"Ta5d6ffAndroid rejected a BLE scan because the app reached its scan-start quotaTa5d6ff"Tb4b4b4,
Te6edf3label Tff7b72= Ta5d6ff"Ta5d6ffble-scan-too-frequentlyTa5d6ff"Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3BluetoothDisabledTb4b4b4(
Te6edf3androidCode Tff7b72= Ta5d6ff"Ta5d6ffBLUETOOTH_DISABLEDTa5d6ff"Tb4b4b4,
Te6edf3description Tff7b72= Ta5d6ff"Ta5d6ffBluetooth is switched offTa5d6ff"Tb4b4b4,
Te6edf3label Tff7b72= Ta5d6ff"Ta5d6ffble-scan-bluetooth-disabledTa5d6ff"Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3LocationServicesDisabledTb4b4b4(
Te6edf3androidCode Tff7b72= Ta5d6ff"Ta5d6ffLOCATION_SERVICES_DISABLEDTa5d6ff"Tb4b4b4,
Te6edf3description Tff7b72= Ta5d6ff"Ta5d6ffLocation services are off, and this Android version requires them for BLE scanningTa5d6ff"Tb4b4b4,
Te6edf3label Tff7b72= Ta5d6ff"Ta5d6ffble-scan-location-services-disabledTa5d6ff"Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Tb4b4b4}
T8b949e/**
* A discovery scan-start failure. No advertisements can be delivered until a future scan starts successfully.
*
* This is an [ExpectedCondition]: every [BleScanStartFailureReason] describes the environment refusing the scan, not a
* defect in the app, so callers should surface it to the user and log it at warn level rather than reporting it.
*/
Tff7b72class T56d364BleScanStartExceptionTb4b4b4(Tff7b72val Te6edf3reasonTb4b4b4: Te6edf3BleScanStartFailureReasonTb4b4b4, Te6edf3causeTb4b4b4: Te6edf3ThrowableTb4b4b4, Tff7b72val Te6edf3retryAfterTb4b4b4: Te6edf3Duration? Tff7b72= Tff7b72nullTb4b4b4) Tb4b4b4:
Te6edf3IllegalStateExceptionTb4b4b4(Ta5d6ff"Ta5d6ffBLE scan could not start: Tffd700${Te6edf3reasonTb4b4b4.Te6edf3androidCodeTffd700}Ta5d6ff"Tb4b4b4, Te6edf3causeTb4b4b4)Tb4b4b4,
Te6edf3ExpectedCondition Tb4b4b4{
Tff7b72override Tff7b72val Te6edf3expectedConditionLabelTb4b4b4: Tffa657String Tff7b72= Te6edf3reasonTb4b4b4.Te6edf3label
Tb4b4b4}
Served by rngit 1.5.1 - Generated in 0.04s